﻿Imports System.ComponentModel
Imports System.Globalization
Imports SharedTools

Public Class RequestStatusToBooleanConverter
    Implements IValueConverter



    Public Function Convert(value As Object, targetType As System.Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert
        If TypeOf value Is CertificateRequestStatus Then
            If DirectCast(value, CertificateRequestStatus) = CertificateRequestStatus.Pending Then
                Return True
            Else
                Return False
            End If
        End If
        Throw New Exception("Converting from " & value.GetType.ToString & " is not supported. This converter can only convert from object of type 'CertificateRequestStatus'")
    End Function

    Public Function ConvertBack(value As Object, targetType As System.Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack
        Throw New Exception("This converter is not designed to convert back, and your code should not try to convert back.")
    End Function

End Class
